package lex.dm.loader;

import java.sql.Connection;

/**
 * Attribute Information: (class attribute has been moved to last column)<br>
 * # Attribute Domain<br>
 * 
 * <pre>
 * -- -----------------------------------------
 * 1. Sample code number id number
 * 2. Clump Thickness 1 - 10
 * 3. Uniformity of Cell Size 1 - 10
 * 4. Uniformity of Cell Shape 1 - 10
 * 5. Marginal Adhesion 1 - 10
 * 6. Single Epithelial Cell Size 1 - 10
 * 7. Bare Nuclei 1 - 10
 * 8. Bland Chromatin 1 - 10
 * 9. Normal Nucleoli 1 - 10
 * 10. Mitoses 1 - 10
 * 11. Class: (2 for benign, 4 for malignant)
 * </pre>
 */
public class WisconsinBreastCancerLoader extends AbstractDataLoader {
	private static final int COLUMN_COUNT = 11;
	private final String fields = "(pid int, clump_thichnedd int, " + "uniformity_of_cell_size int, uniformity_of_cell_shape int, "
			+ "marginal_adhesion int, single_epithelial_cell_size int, " + "bare_nuclei int, bland_chromatin int, normal_nucleoli int, "
			+ "mitoses int, class int)";

	public WisconsinBreastCancerLoader(Connection con, String tableName) {
		super(con, tableName);
	}

	public int getColumnCount() {
		return COLUMN_COUNT;
	}

	public String getCreateTableSQL() {
		return "create table " + this.getTableName() + fields;
	}
	// public void load( InputStream in ) throws IOException, SQLException
	// {
	// this.prepareTable( con, tableName, "create table " + tableName + fields
	// );
	// BufferedReader reader = new BufferedReader( new InputStreamReader( in )
	// );
	// String line = null;
	// StringBuilder buf = new StringBuilder();
	// String cmd = "insert into " + tableName + " values (";
	// Statement s = con.createStatement();
	// s.execute( "delete from " + tableName );
	// while( true )
	// {
	// line = reader.readLine();
	// if( null == line )
	// {
	// IO.closeQuietly( reader );
	// break;
	// }
	// String[] tokens = Splitter.CommaSplitter.split( line );
	// if( COLUMN_COUNT != tokens.length )
	// {
	// System.err.println( "format error: " + line + " -> " + tokens.length + "
	// tokens" );
	// continue;
	// }
	// else
	// {
	// // insert record
	// buf.setLength( 0 );
	// buf.append( cmd );
	// for( int i = 0; i < tokens.length; i++ )
	// {
	// if( MISSING_VALUES.equals( tokens[i] ) )
	// tokens[i] = "null";
	// buf.append( tokens[i] );
	// if( i < tokens.length - 1 )
	// buf.append( ',' );
	// }
	// buf.append( ')' );
	// s.execute( buf.toString() );
	// this.stepCounter( 1 );
	// }
	// }
	// }
}
